package com.macro.service.impl;

import com.macro.entity.SysUser;
import com.macro.mapper.SysUserMapper;
import com.macro.service.SysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 用户信息
 * 业务接口实现类
 */
@Service
public class SysUserServiceImpl implements SysUserService {

    @Resource
    private SysUserMapper sysUserMapper;

    /**
     * 根据用户名和密码查询是否有该用户
     * @param uname     用户名
     * @param upwd      密码
     * @return
     */
    public String findUserByNameAndPwdCount(String uname,String upwd){
        if(sysUserMapper.selectUserByNameAndPwdCount(uname,upwd)==null){
            return "2";
        }else{
            return sysUserMapper.selectUserByNameAndPwdCount(uname,upwd);
        }
    }

    /**
     * 根据用户名和密码查询用户信息及权限信息
     * @param uname     用户名
     * @param upwd      密码
     * @return
     */
    public SysUser findUserByNameAndPwd(String uname,String upwd){
        SysUser sysUser=sysUserMapper.selectUserByNameAndPwd(uname,upwd);
        return sysUser;
    }


}
